import React from 'react';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import { List, Icon } from 'antd-mobile';
import content from '../../../common/contentCss/content.css';
import CustTitle from '../../../common/title/title';
import MyCollectionList from './pages/myCollection/myCollectionList';
// import MyCollectionList from '../../../../../common/lists/CustomList';


const listItem = {"birthday":"1983-05-07 00:00:00","vipValidDate":"2017-10-28 14:52:23","serviceArea":"接待,证道,传福音,关怀","decissionTime":"1988-01-01 00:00:00","church":"广州天河堂","verified":2,"maskAvatar":"http://112.74.26.228:8000/876708082437197824/b1cdcb82-5c82-465e-9fc4-d39bdc3c0da8.png","avatar":"http://112.74.26.228:8000/876708082437197824/83d1112c-00fe-49ca-b634-d392717ec7e3.png","mediatorId":"912867046123110401","type":1,"vipLevel":2,"baptized":"1996-01-01 00:00:00","lastLoginTime":"2017-10-14 16:43:27","u_id":"123467","createTime":"2017-09-27 10:13:27","name":"高新领队招募","id":"912862718893228034","followerCount":0,"loveStatus":2}

function MyCollection({dispatch,loading,myCollection}) {

  const {list} = myCollection
  console.log('route收藏列表',list);
  const titleProps = {
    titleName:'我的收藏',
    goBack(){
      history.go(-1);
    },
  };

  const myCollectionListProps = {
    loading,
    list: list,
    onViewMember(id){
      dispatch(routerRedux.push({
        pathname: '/part-time-detail',
        query: {
          id,
        }
      }));
    },
    onPagination() {
      // if (loading || JSON.stringify(list) == "[]") {
      //   return;
      // }
      if (pageNum >= pages) {
        return;
      };
      dispatch({
        type: 'members/query',
        payload: {
          pageNum: pageNum + 1,
        }
      })
    },
    showLimit(id){
      onViewMember(id);
    }
  }

  const MarginHeight = () => <div style={{height: '0.6em', backgroundColor:'#F5F5F9'}}></div>;

  return(
    <div className={content.content}>
      <CustTitle {...titleProps}/>
      <div style={{
        marginTop: '2.8125em',
      }}>
      <MyCollectionList {...myCollectionListProps}/>
      </div>
    </div>
  )
}

function mapStateToProps(state, ownProps) {
  return {
    myCollection:state.myCollection,
  }
}

export default connect(mapStateToProps)(MyCollection);
